package com.skysz.jaxb;

import java.io.StringWriter;
import java.io.Writer;

import javax.xml.bind.JAXBContext;
import javax.xml.bind.JAXBException;
import javax.xml.bind.Marshaller;

public class Test {

	/**
	 * @param args
	 * @throws JAXBException 
	 */
	public static void main(String[] args) throws JAXBException {
		JAXBContext jc = JAXBContext.newInstance(Element.class);
		Marshaller m = jc.createMarshaller();
		m.setProperty(Marshaller.JAXB_ENCODING, "utf-8");
		m.setProperty(Marshaller.JAXB_FORMATTED_OUTPUT, Boolean.TRUE);
		Element e = new Element();
		e.setName("liuxl");
		e.setSex("m");
		e.setXmlns("urn:iso:std:iso:20022:tech:xsd:pain.001.001.02");
		e.setXmlnsXsi("http://www.w3.org/2001/XMLSchema-instance");
		Writer wr = new StringWriter();
		String str = "";
		m.marshal(e, wr);
		System.out.println(wr.toString());
	}

}
